<html>
<head>
	<?php $this->load->view('config/head');?>
</head>
<body>
	<?php $this->load->view('config/awal_body');?>
	
	<h3>List Menu</h3>
	<a href="<?php echo site_url()?>mg_menu/add" class="btn">Create menu</a>
	<br/>
	<br/>
	
	<?php $success = $this->session->flashdata('success');?>
	<?php if ($success):?>
		<div class="alert alert-success">
			Data telah tersimpan
		</div>
	<?php endif?>
	
	<?php $error = $this->session->flashdata('error');?>
	<?php if ($error):?>
		<div class="alert alert-error">
			Data gagal tersimpan
		</div>
	<?php endif?>
	
	<?php $delete = $this->session->flashdata('delete');?>
	<?php if ($delete):?>
		<div class="alert alert-success">
			Data telah terhapus
		</div>
	<?php endif?>

	<?php if (@$results):?>
	<table width="100%" class="table table-hover">
		<tr>
			<th>Name menu</th>
			<th>Title menu</th>
			<th>Action</th>
		</tr>
		<?php foreach ($results as $row):?>
		<tr>
			<td><?php echo $row['nama_menu']?></td>
			<td><?php echo $row['title_menu']?></td>
			<td align="center">
				<a href="<?php echo site_url()?>mg_menu/edit/<?php echo $row['id_menu']?>" class="icon-edit" title="Edit"></a> &nbsp; 
				<a href="<?php echo site_url()?>mg_menu/delete/<?php echo $row['id_menu']?>" class="icon-trash" title="Delete" onclick="return confirm('Anda yakin akan menghapus data ini?');"></a>
			</td>
		</tr>
		<?php endforeach?>
	</table>
	<?php else:?>
		<div class="alert alert-error">
			Not found data
		</div>
	<?php endif?>

	<?php $this->load->view('config/akhir_body');?>
</body>
</html>
